{template '_header'}

<div class="page-header">当前位置：<span class="text-primary">商品销售排行</span></div>

        <div class="page-content">
            <form action="./index.php" method="get" class="form-horizontal">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="mx_shop" />
                <input type="hidden" name="do" value="web" />
                <input type="hidden" name="r"  value="statistics.goods_rank" />
                <div class="page-toolbar m-b-sm m-t-sm">
                    <div class="col-sm-5">
                        {php echo tpl_daterange('datetime', array('sm'=>true,'placeholder'=>'下单时间'),true);}
                    </div>
                    <div class="col-sm-6 pull-right">
                        <div class="input-group">
                            <span class="input-group-select">
                                <select name='orderby'  class='form-control '   style="width:110px;">

                                    <option value='' {if $_GPC['orderby']==''}selected{/if}>排序</option>
                                    <option value='0' {if $_GPC['orderby']=='0'}selected{/if}>按销售额</option>
                                    <option value='1' {if $_GPC['orderby']=='1'}selected{/if}>按销售量</option>
                                </select>
                            </span>
                            <input type="text" class="form-control"  name="title" value="{$_GPC['title']}" placeholder="商品名称"/>
				<span class="input-group-btn">
					<button class="btn btn-primary" type="submit"> 搜索</button>
   {ifp 'statistics.goods_rank.export'}
                    <button type="submit" name="export" value="1" class="btn btn-success">导出</button>
                    {/if}
				</span>
                        </div>
                    </div>
                </div>
            </form>

            {if empty($list)}
            <div class="panel panel-default">
                <div class="panel-body empty-data">未查询到相关数据</div>
            </div>
            {else}
            <table class="table table-hover">
                <thead>
                <tr>
                    <th style='width:80px;'>排行</th>
                    <th>商品名称</th>
                    <th style="width: 150px;">销售量</th>
                    <th style="width: 150px;">销售额</th>
                </tr>
                </thead>
                <tbody>
                {loop $list $key $row}
                <tr>
                    <td>{if  ($pindex -1)* $psize + $key + 1<=3}
                        <labe class='label label-danger' style='padding:8px;'>&nbsp;{php echo ($pindex -1)* $psize + $key + 1}&nbsp;</labe>
                        {else}
                        <labe class='label label-default'  style='padding:8px;'>&nbsp;{php echo ($pindex -1)* $psize + $key + 1}&nbsp;</labe>
                        {/if}
                    </td>
                    <td>
                        <img src="{php echo tomedia($row['thumb'])}" style="width: 30px; height: 30px;border:1px solid #ccc;padding:1px;"  onerror="this.src='../addons/mx_shop/static/images/nopic.png'" >
                        {$row['title']}</td>
                    <td>{$row['count']}</td>
                    <td>{$row['money']}</td>
                </tr>
                {/loop}
                </tbody>
                <tfoot >
                    <tr>
                        <td colspan="4" style="text-align: right">
                            {$pager}
                        </td>
                    </tr>
                </tfoot>
            </table>
            {/if}
        </div>

{template '_footer'}